<template>
  <div class="content-nav">
      <div class="left-nav" ref="leftNavRef" @click="clickHandler">
          <div class="item active">全部</div>
          <div class="item">我创建的</div>
          <div class="item">我加入的</div>
          <div class="item">我课程的</div>
      </div>
      <div class="right-nav">
          <div class="btn" @click="showLayer = 'block'">创建</div>
      </div>
  </div>

  <div class="content-data">
      <!-- 如果有数据就展示 -->
      <div class="show-area">
          
      </div>

      <!-- 如果没有数据就展示该页面 -->
      <div class="none-data">
          <div class="img-data">
              <img src="https://rs.dance365.com/img/no_content@3x.0fd78ad2.png">
          </div>
          <div class="word-data">
              <p>无更多数据</p>
          </div>
      </div>
  </div>

  <div class="layer" :style="{display: showLayer}" @click="showLayer = 'none'">
      <div class="content">
          <div class="layer-data">
              <div class="title">请打开 中舞网APP 扫码,使用此功能</div>
              <img src="https://tse2-mm.cn.bing.net/th/id/OIP-C.MUlbLzlpd9NoXs3BJAzi9AHaGI?w=207&h=180&c=7&r=0&o=5&dpr=1.15&pid=1.7" alt="二维码图片">
              <div class="bottom">扫描此二维码，同样可下载</div>
              <span>“中舞网APP”</span>
          </div>
      </div>
  </div>
</template>

<script lang="ts">
export default {
  name: 'MyRoom'
}
</script>

<script setup lang="ts">
  import { ref, onMounted } from 'vue';

  const leftNavRef = ref();
  const showLayer = ref('none')

  const clickHandler = () => {
      const navList = leftNavRef.value.children;
      for (let i = 0; i < navList.length; i++) {
          if (navList[i].classList.contains('item')) {
              navList[i].onclick = function () {
                  for (let j = 0; j < navList.length; j++) {
                      navList[j].classList.remove('active');
                  };
                  navList[i].classList.add('active');
              };
          };
      };
  };

  onMounted(() => {
      clickHandler();
  });

</script>

<style scoped>
button {
  border: none;
}
.content-nav {
  display: flex;
  justify-content: space-between;
  padding: 26px 30px;
  margin-bottom: 10px;
  background-color: #fff;
  border-radius: 5px;
  font-size: 14px;
}
.content-nav .left-nav {
  display: flex;
}
.content-nav .left-nav .item {
  padding: 9px 12px;
  margin: 0 24px 10px 0;
  color: #7d8090;
  cursor: pointer;
}
.content-nav .left-nav .active {
  background-color: #f93684;
  color: #fff;
  border-radius: 5px;
}
.content-nav .right-nav {
  height: 46px;
  line-height: 46px;
}
.content-nav .right-nav .btn {
  display: inline-block;
  width: 84px;
  height: 32px;
  text-align: center;
  line-height: 32px;
  background-color: #f93684;
  color: #fff;
  border-radius: 15px;
  vertical-align: middle;
  cursor: pointer;
}
.content-data {
  position: relative;
  height: 720px;
  padding: 0 30px 10px;
  margin-bottom: 20px;
  background-color: #fff;
}
.content-data .none-data {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.content-data .none-data .word-data {
  text-align: center;
  margin: 20px 0 40px;
  color: #7d8090;
  font-size: 16px;
}
.layer {
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(116, 116, 116, 0.6);
  top: 0;
  left: 0;
}
.layer .content {
  position: absolute;
  box-sizing: border-box;
  width: 270px;
  height: 263px;
  padding-bottom: 10px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border-radius: 5px;
}
.layer .content .layer-data {
  padding: 20px;
  text-align: center;
  font-size: 14px;
}
.layer .content .layer-data .title {
  margin: 14px 0;
  color: #626066;
}
.layer .content .layer-data img {
  width: 130px;
  height: 130px;
  margin-left: auto;
  margin-right: auto;
}
.layer .content .layer-data .bottom {
  margin: 5px 10px;
  color: #7d8090;
}
.layer .content .layer-data span {
  color: #f92c82;
}

</style>